<template>
	<view>
		<kevy-empty :show="!msg_list.length"></kevy-empty>
		<view class="main_container" v-if="msg_list.length">
			<comment-message v-for="msg in msg_list" :msg="msg"></comment-message>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				offset: 0,
				msg_list: [],
			}
		},
		async onReachBottom() {
			let data = await uni.request({
				url: getApp().globalData.base_url + `/get/notice/${this.offset}`,
				header: {"token": getApp().globalData.access_token}
			})
			let msg_list = data.data
			this.offset += msg_list.length
			msg_list.forEach(e => {
				this.msg_list.push(e)
			})
			// this.msg_list = msg_list
			// console.log(msg_list)
		},
		async onLoad(){
			let data = await uni.request({
				url: getApp().globalData.base_url + `/get/notice/${this.offset}`,
				header: {"token": getApp().globalData.access_token}
			})
			let msg_list = data.data
			this.offset = msg_list.length
			this.msg_list = msg_list
			// console.log(msg_list)
		},
		methods: {
			
		}
	}
</script>

<style>
	.main_container {
		padding: 4px;
	}
</style>
